package com.ysd.web.Servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.web.daoimpl.CompanyInfoDaoImpl;
import com.ysd.web.daoimpl.ProductDaoImpl;
import com.ysd.web.entity.CompanyInfo;
import com.ysd.web.entity.Product;

public class ContactServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		CompanyInfoDaoImpl cid=new CompanyInfoDaoImpl();
		ProductDaoImpl pd=new ProductDaoImpl();
		CompanyInfo ci=cid.selectCinfo();
		List<Product> plist =pd.selectProByIswhile();
		request.setAttribute("ci", ci);
		request.setAttribute("plist", plist);
		request.getRequestDispatcher("contact.jsp").forward(request, response);
		
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

			doGet(request, response);
	}
}
